import React, { Component } from 'react'
import axios from 'axios'
import MainBanner from './MainBanner';
import MainProductList from './MainProductList';
export class Main extends Component {
  constructor(props) {
    super(props);
    this.state = {
      banner: [],
      productList: []
    }
  }
  componentDidMount () {
    axios.get('http://123.207.32.32:8000/home/multidata').then(res => {
      console.log(res);
      this.setState({
        banner: res.data.data.banner.list,
        productList: res.data.data.recommend.list
      })
    });
  }
  render () {
    const { banner, productList } = this.state;
    console.log('productList', productList);
    console.log('banner', banner);
    let title = '轮播图';
    return (
      <div>
        main
        <MainBanner name={title} banner={banner} />
        <MainProductList productList={productList} />
      </div>
    )
  }
}
export default Main;